﻿Imports extremo

Public Class ProveedoresEliminar
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim id = Request.Params.Get("id")

        Dim negocio = New ProveedorNegocio
        Dim modelo = negocio.obtener(id)

        Me.txtidproveedor.Value = modelo.idproveedor
        Me.txtNombre.Text = modelo.nombre
        Me.txtruc.Text = modelo.ruc
        Me.txtdireccion.Text = modelo.direccion
        Me.txttelefono.Text = modelo.telefono
    End Sub

    Protected Sub btnRegresar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnRegresar.Click
        Response.Redirect("Proveedores.aspx", True)
    End Sub

    Protected Sub btnEliminar_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnEliminar.Click
        Try
            Dim negocio = New ProveedorNegocio
            negocio.eliminar(Me.txtidproveedor.Value)
            Response.Redirect("Proveedores.aspx", True)
        Catch ex As Exception
            Response.Write("No se pudo eliminar")
        End Try
    End Sub
End Class